package com.p2p.controller.fundManagement;

import com.p2p.common.R;
import com.p2p.common.base.RespResult;
import com.p2p.service.fundManagementService.impl.RechargeRecordService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/fundManagement")
@Api(value = "充值记录",tags = "充值记录API")
public class RechargeRecordController {

    @Autowired
    RechargeRecordService rechargeRecordService;

    @RequestMapping(value = "/findAllRechargeRecordList",method = RequestMethod.GET)
    @ApiOperation(value = "充值记录接口",notes = "查找所有充值记录信息",httpMethod = "GET", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="登录成功"),
            @ApiResponse(code=400,message="代表参数格式不对"),
            @ApiResponse(code=404,message="代表找不到此请求"),
            @ApiResponse(code=500,message="代表后端代码出现异常"),
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数默认第一页",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",paramType = "query",dataType = "String",required = true)
    })
    @ResponseBody
    public RespResult findAllRechargeRecordList(Integer currentPage, Integer pageSize){
        return rechargeRecordService.getAllRechargeRecordList(currentPage,pageSize);
    }

    @RequestMapping(value = "/findAllRechargeRecordListByRechargeOddNumber",method = RequestMethod.GET)
    @ApiOperation(value = "充值记录接口",notes = "通过充值单号查找资金管理信息",httpMethod = "GET", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="登录成功"),
            @ApiResponse(code=400,message="代表参数格式不对"),
            @ApiResponse(code=404,message="代表找不到此请求"),
            @ApiResponse(code=500,message="代表后端代码出现异常"),
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数默认第一页",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "rechargeOddNumber",value = "充值单号",paramType = "query",dataType = "String",required = true)
    })
    @ResponseBody
    public RespResult findAllRechargeRecordListByRechargeOddNumber(Integer currentPage,Integer pageSize,String rechargeOddNumber){
        return rechargeRecordService.getAllRechargeRecordListByRechargeOddNumber(currentPage,pageSize,rechargeOddNumber);
    }

    @RequestMapping(value = "/findAllRechargeRecordListByPhone",method = RequestMethod.GET)
    @ApiOperation(value = "充值记录接口",notes = "通过充值电话查找资金管理信息",httpMethod = "GET", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="登录成功"),
            @ApiResponse(code=400,message="代表参数格式不对"),
            @ApiResponse(code=404,message="代表找不到此请求"),
            @ApiResponse(code=500,message="代表后端代码出现异常"),
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数默认第一页",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "phone",value = "电话号码",paramType = "query",dataType = "String",required = true)
    })
    @ResponseBody
    public RespResult findAllRechargeRecordListByPhone(Integer currentPage,Integer pageSize,String phone){
        return rechargeRecordService.getAllRechargeRecordListByPhone(currentPage,pageSize,phone);
    }

    @RequestMapping(value = "/findAllRechargeRecordListByRechargeMethod",method = RequestMethod.GET)
    @ApiOperation(value = "充值记录接口",notes = "通过充值电话查找资金管理信息",httpMethod = "GET", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="登录成功"),
            @ApiResponse(code=400,message="代表参数格式不对"),
            @ApiResponse(code=404,message="代表找不到此请求"),
            @ApiResponse(code=500,message="代表后端代码出现异常"),
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数默认第一页",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "rechargeMethod",value = "充值方式",paramType = "query",dataType = "String",required = true)
    })
    @ResponseBody
    public RespResult findAllRechargeRecordListByRechargeMethod(Integer currentPage,Integer pageSize,String rechargeMethod){
        return rechargeRecordService.getAllRechargeRecordListByRechargeMethod(currentPage,pageSize,rechargeMethod);
    }

    @RequestMapping(value = "/findAllRechargeRecordListByTime",method = RequestMethod.GET)
    @ApiOperation(value = "充值记录接口",notes = "通过充值电话查找资金管理信息",httpMethod = "GET", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="登录成功"),
            @ApiResponse(code=400,message="代表参数格式不对"),
            @ApiResponse(code=404,message="代表找不到此请求"),
            @ApiResponse(code=500,message="代表后端代码出现异常"),
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数默认第一页",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "startTime",value = "开始时间",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "stopTime",value = "结束时间",paramType = "query",dataType = "String",required = true)

    })
    @ResponseBody
    public RespResult findAllRechargeRecordListByTime(Integer currentPage,Integer pageSize,String startTime,String stopTime){
        System.out.println(startTime+stopTime);
        return rechargeRecordService.getAllRechargeRecordListByTime(currentPage,pageSize,startTime,stopTime);
    }

    @RequestMapping(value = "/findAllRechargeRecordListByStatus",method = RequestMethod.GET)
    @ApiOperation(value = "充值记录接口",notes = "通过充值电话查找资金管理信息",httpMethod = "GET", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="登录成功"),
            @ApiResponse(code=400,message="代表参数格式不对"),
            @ApiResponse(code=404,message="代表找不到此请求"),
            @ApiResponse(code=500,message="代表后端代码出现异常"),
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数默认第一页",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "status",value = "充值状态",paramType = "query",dataType = "String",required = true)
    })
    @ResponseBody
    public RespResult findAllRechargeRecordListByStatus(Integer currentPage,Integer pageSize,Byte status){
        return rechargeRecordService.getAllRechargeRecordListByStatus(currentPage,pageSize,status);
    }

    @RequestMapping(value = "/exportRechargeRecordList",method = RequestMethod.GET)
    @ApiOperation(value = "充值记录接口",notes = "通过充值电话查找资金管理信息",httpMethod = "GET", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="登录成功"),
            @ApiResponse(code=400,message="代表参数格式不对"),
            @ApiResponse(code=404,message="代表找不到此请求"),
            @ApiResponse(code=500,message="代表后端代码出现异常"),
    })
    @ResponseBody
    public R exportRechargeRecordList(Object org){
        return new R(200,"success",org);
    }

}
